package com.company.nowcoder;

public class 生产口罩 {

    // m名员工，nn条生产线(0.....n-1)，
    public int producemask (int n, int m, Point[][] strategy) {
        int[][] dp = new int[n + 1][m + 1];

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                dp[i][j] = dp[i - 1][j];
                for (Point point : strategy[i - 1]) {
                    if (j > point.x ) {
                        dp[i][j] = Math.max(dp[i - 1][j - point.x] + point.y, dp[i][j]);
                    }
                }
            }
        }

        return dp[n][m];
    }

}

class Point{
    int x,y;
}
